package com.zhongli.devplatform.service.impl.common;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhongli.devplatform.bean.SecurityHelper;
import com.zhongli.devplatform.mapper.grade.ReadGradeMapper;
import com.zhongli.devplatform.po.common.ReadGradePO;
import com.zhongli.devplatform.query.sys.GradeQuery;
import com.zhongli.devplatform.service.imp.common.ReadClazzService;
import com.zhongli.devplatform.service.imp.common.ReadGradeService;
import com.zhongli.devplatform.service.imp.user.ReadUserService;
import com.zhongli.devplatform.vo.common.GradeVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 年级表(ReadGrade)表服务实现类
 *
 * @author aiyuan
 * @since 2020-07-30 16:52:18
 */
@Service
public class ReadGradeServiceImpl extends ServiceImpl<ReadGradeMapper, ReadGradePO> implements ReadGradeService {

    @Resource
    private ReadGradeMapper gradeMapper;

    @Resource
    private ReadUserService userService;

    @Resource
    private ReadClazzService clazzService;


    /**
     * 根据老师查询出所教授的年级
     * @return 结果集
     */
    @Override
    public List<GradeVO> getAllGradeByTeacherId( GradeQuery gradeQuery) {
        Integer currentTeacherId = SecurityHelper.getCurrentUserId();
        return gradeMapper.getAllGradeByTeacherId(currentTeacherId,gradeQuery);
    }

    /*@Override
    public ReadGradePO getCurrentStuGrade(Integer currentStuId) {
        ReadUserPO userPO = userService.getById(currentStuId);
        clazzService.getById()
        return null;
    }*/

}
